<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<style>
blockquote {
    color: blue;
}
</style>
<div id="sample" contentEditable style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
<DIV><DIV>On Feb 1, 2006, at 7:37 PM, David Hyatt wrote:</DIV><BR class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"><DIV
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px;
margin-left: 0px; ">While reworking images I ran into something that
really concerns me.<SPAN>
</SPAN>WebElementImageKey is a key added to the elementAtPoint
dictionary and the key's value is an NSImage.<SPAN
> </SPAN>Unfortunately we use
CGImageRef now.<SPAN> </SPAN>What
this means is that as you move the mouse around a web page we are
aggressively mallocing NSImages that then move into our image cache and
stay around until the CGImageRef goes away (which could be a long
time).</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px;
margin-left: 0px; ">I think this is terrible but am not sure how to fix
it.<SPAN> </SPAN>I assume this key is
public API.<SPAN> </SPAN>Could we
change the key's value to be a CGImageRef instead?<SPAN
> </SPAN>Could we just eliminate the
key in favor of a DOM extension method for accessing an
NSImage?</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px;
margin-left: 0px; ">dave</DIV><DIV style=3D"margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
">(hyatt@apple.com)</DIV><DIV id="anchor" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px;"><BR></DIV> </BLOCKQUOTE></DIV><BR>
</div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    var sample = document.getElementById('sample');
    selection.collapse(sample, sample.childNodes.length);
    selection.modify('move', 'backward', 'line');

    var anchor = document.getElementById('anchor');
    assert_equals(selection.anchorNode, anchor, 'anchorNode');
    assert_equals(selection.anchorOffset, 0, 'anchorOffset');
    assert_equals(selection.focusNode, anchor, 'focusNode');
    assert_equals(selection.focusOffset, 0, 'focusOffset');
});
</script>
